﻿<Window
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	mc:Ignorable="d"
	x:Class="Microsoft.Research.ScientificWorkflow.UIDesigner.RunWindow"
	d:DesignWidth="640" d:DesignHeight="480" Width="453" Height="770" 
    xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
    xmlns:Controls1="clr-namespace:Microsoft.Research.ScientificWorkflow.UIDesigner"
    xmlns:Toolkit="clr-namespace:Microsoft.Windows.Controls;assembly=WpfToolkit"
    WindowStyle="None" ShowInTaskbar="False"
    WindowStartupLocation="CenterOwner" ResizeMode="NoResize" AutomationProperties.AutomationId="AIdRunWindow">

    <Window.Resources>
        <Controls1:DeleteEnabledConverter x:Key="deleteEnabledConverter"></Controls1:DeleteEnabledConverter>
        <Style x:Key="PopupCloseButton" BasedOn="{x:Null}" TargetType="{x:Type Button}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Grid>
                            <Rectangle Fill="#FFCCCCCC" Stroke="{x:Null}" RadiusX="4.5" RadiusY="4.5" x:Name="rectangle"/>
                            <Rectangle Fill="#FF4F4F4F" Stroke="{x:Null}" RadiusX="0" RadiusY="0" Margin="8,3.5,7,3.5" RenderTransformOrigin="0.5,0.5">
                                <Rectangle.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform ScaleX="1" ScaleY="1"/>
                                        <SkewTransform AngleX="0" AngleY="0"/>
                                        <RotateTransform Angle="-34.039"/>
                                        <TranslateTransform X="0" Y="0"/>
                                    </TransformGroup>
                                </Rectangle.RenderTransform>
                            </Rectangle>
                            <Rectangle Fill="#FF4F4F4F" Stroke="{x:Null}" RadiusX="0" RadiusY="0" RenderTransformOrigin="0.5,0.5" Margin="8,3.5,7,3.5">
                                <Rectangle.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform ScaleX="-1" ScaleY="1"/>
                                        <SkewTransform AngleX="0" AngleY="0"/>
                                        <RotateTransform Angle="34.039"/>
                                        <TranslateTransform X="0" Y="0"/>
                                    </TransformGroup>
                                </Rectangle.RenderTransform>
                            </Rectangle>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsFocused" Value="True"/>
                            <Trigger Property="IsDefaulted" Value="True"/>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="Fill" TargetName="rectangle" Value="#FFADADAD"/>
                            </Trigger>
                            <Trigger Property="IsPressed" Value="True"/>
                            <Trigger Property="IsEnabled" Value="False"/>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Window.Resources>

    <Grid x:Name="LayoutRoot">
        <Border BorderBrush="#FFBDBDBD" BorderThickness="1,1,2,2" CornerRadius="4,4,4,4" Margin="0,0,0,0" VerticalAlignment="Stretch">
            <Border.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FFF7F7F7" Offset="0"/>
                    <GradientStop Color="#FFF1F1F1" Offset="1"/>
                </LinearGradientBrush>
            </Border.Background>
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="28"/>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="30"/>
                </Grid.RowDefinitions>
                <Border Name="brdrHeader" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Grid.Row="0" CornerRadius="4,4,0,0">
                    <Border.Background>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="#FFF7F7F7" Offset="0"/>
                            <GradientStop Color="#FFE9E9E9" Offset="1"/>
                        </LinearGradientBrush>
                    </Border.Background>
                    <Grid>
                        <TextBlock x:Name="TitleTextBlock" HorizontalAlignment="Left" Margin="5,0,0,0" VerticalAlignment="Center" FontSize="14" Foreground="#FF5F5F5F" TextWrapping="Wrap"/>
						<Button HorizontalAlignment="Right" Margin="0,5.5,5,5.5" Style="{DynamicResource PopupCloseButton}" Width="17" Click="CancelButton_Click"/>
					</Grid>
                </Border>
                <Border HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderBrush="#FFC8C8C8" BorderThickness="0,1,0,0" Grid.Row="2">
                    <Border.Background>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="#FFF0F0F0" Offset="0"/>
                            <GradientStop Color="#FFD2D2D2" Offset="0.991"/>
                        </LinearGradientBrush>
                    </Border.Background>
                    <Grid>
                        <StackPanel HorizontalAlignment="Right" Margin="0,0,15,0" VerticalAlignment="Center" Orientation="Horizontal">
                            <Button IsDefault="True" Width="85" Content="Execute" Click="ExecuteButton_Click"/>
                            <Button IsCancel="True" HorizontalAlignment="Stretch" Click="CancelButton_Click" Margin="5,0,0,0" VerticalAlignment="Stretch" Width="85" Content="Cancel"/>
                        </StackPanel>
                    </Grid>
                </Border>
                <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.RowSpan="1" Grid.Row="1">
                    <StackPanel>
                        <!-- Property list-->
                        <Border BorderBrush="#FFC8C8C8" BorderThickness="1,1,1,1" CornerRadius="5,5,5,5" Margin="10,10,10,0">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="25"/>
                                    <RowDefinition Height="*"/>
                                </Grid.RowDefinitions>
                                <Border HorizontalAlignment="Stretch" Margin="0,0,0,0" VerticalAlignment="Stretch" Grid.Row="0" CornerRadius="5,5,0,0">
                                    <Border.Background>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                            <GradientStop Color="#FFFFFFFF" Offset="0"/>
                                            <GradientStop Color="#FFE8E8E8" Offset="1"/>
                                        </LinearGradientBrush>
                                    </Border.Background>
                                    <Grid>
                                        <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" Text="Required Parameters" TextWrapping="Wrap" Margin="5,0,0,0" FontSize="13"/>
									</Grid>
                                </Border>
                                <StackPanel VerticalAlignment="Stretch" Grid.Row="1">
                                        <Controls1:PropertyListControl x:Name="propertyListControl" Margin="5,5,2,5" Height="150"></Controls1:PropertyListControl>
                                    <Controls1:OutputPropertyListControl x:Name="outputPropertyListControl" Margin="5,5,2,5" Height="150"></Controls1:OutputPropertyListControl>
                                </StackPanel>
                            </Grid>
                        </Border>
                        
                        <!--Additional params-->
                        <Border BorderBrush="#FFC8C8C8" BorderThickness="1,1,1,1" CornerRadius="5,5,5,5" Margin="10,10,10,0">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="25"/>
                                    <RowDefinition Height="*"/>
                                </Grid.RowDefinitions>
                                <Border HorizontalAlignment="Stretch" Margin="0,0,0,0" VerticalAlignment="Stretch" Grid.Row="0" CornerRadius="5,5,0,0">
                                    <Border.Background>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                            <GradientStop Color="#FFFFFFFF" Offset="0"/>
                                            <GradientStop Color="#FFE8E8E8" Offset="1"/>
                                        </LinearGradientBrush>
                                    </Border.Background>
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="*"/>
                                        </Grid.ColumnDefinitions>
                                        <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" Text="Additional Parameters" TextWrapping="Wrap" Margin="5,0,0,0" FontSize="13"/>
								</Grid>
                                </Border>
                                <Border BorderBrush="#FFC8C8C8" Grid.Row="1" BorderThickness="1,0,1,1" CornerRadius="0,0,5,5" Grid.RowSpan="1" Margin="0,0,0,0">
                                    <Grid>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="*"/>
                                            <RowDefinition Height="30"/>
                                        </Grid.RowDefinitions>
                                        <Toolkit:DataGrid Height="100" HorizontalScrollBarVisibility="Disabled" Margin="5,5,2,5" Grid.RowSpan="1" x:Name="additionalParametersGrid" CanUserResizeColumns="False" CanUserResizeRows="False" CanUserDeleteRows="False"  CanUserAddRows="False" CanUserReorderColumns="False" CanUserSortColumns="False" AutoGenerateColumns="False" SelectionMode="Single" HorizontalGridLinesBrush="LightGray" VerticalGridLinesBrush="LightGray">
                                            <Toolkit:DataGrid.Columns>
                                                <Toolkit:DataGridTextColumn Width="120" Binding="{Binding Path=Domain}" Header="Domain"></Toolkit:DataGridTextColumn>
                                                <Toolkit:DataGridTextColumn Width="130" Binding="{Binding Path=Parameter}" Header="Parameter Name"></Toolkit:DataGridTextColumn>
                                                <Toolkit:DataGridTextColumn Width="160" Binding="{Binding Path=ParameterValue}" Header="Parameter Value"></Toolkit:DataGridTextColumn>
                                            </Toolkit:DataGrid.Columns>
                                        </Toolkit:DataGrid>
                                        <Border HorizontalAlignment="Stretch" Margin="0,0,0,0" CornerRadius="0,0,5,5" Grid.Row="1" BorderThickness="0,1,0,0" BorderBrush="#FFE4E4E4">
                                            <Border.Background>
                                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                    <GradientStop Color="#FFFFFFFF" Offset="0"/>
                                                    <GradientStop Color="#FFEAEAEA" Offset="0.991"/>
                                                </LinearGradientBrush>
                                            </Border.Background>
                                            <StackPanel VerticalAlignment="Center" Orientation="Horizontal" HorizontalAlignment="Right">
                                                <Button Content="Delete" Width="60" Margin="0,0,5,0" Click="DeleteButton_Click">
                                                    <Button.IsEnabled>
                                                        <MultiBinding Converter="{StaticResource deleteEnabledConverter}">
                                                            <Binding ElementName="additionalParametersGrid" Path="HasItems"></Binding>
                                                            <Binding ElementName="additionalParametersGrid" Path="SelectedItem"></Binding>
                                                        </MultiBinding>
                                                    </Button.IsEnabled>
                                                </Button>
                                                <Button Content="Add" Width="60" Click="AddButton_Click"/>
                                            </StackPanel>
                                        </Border>
                                    </Grid>
                                </Border>
                            </Grid>
                        </Border>
                        <!-- Notes -->
                        <Border BorderBrush="#FFC8C8C8" BorderThickness="1,1,1,1" CornerRadius="5,5,5,5" Margin="10,10,10,5">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="25"/>
                                    <RowDefinition Height="*"/>
                                </Grid.RowDefinitions>
                                <Border HorizontalAlignment="Stretch" Margin="0,0,0,0" VerticalAlignment="Stretch" Grid.Row="0" CornerRadius="5,5,0,0">
                                    <Border.Background>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                            <GradientStop Color="#FFFFFFFF" Offset="0"/>
                                            <GradientStop Color="#FFE8E8E8" Offset="1"/>
                                        </LinearGradientBrush>
                                    </Border.Background>
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="*"/>
                                        </Grid.ColumnDefinitions>
                                        <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" Text="Notes" TextWrapping="Wrap" Margin="5,0,0,0" FontSize="13"/>
								</Grid>
                                </Border>
                                <StackPanel HorizontalAlignment="Stretch" Margin="5,2,5,5" Grid.Row="1" Grid.RowSpan="1">
                                    <TextBox x:Name="notesTextBox" MaxLines="4" MaxLength="250" TextWrapping="Wrap" ScrollViewer.CanContentScroll="True" VerticalScrollBarVisibility="Auto" Margin="0,2,5,2" Height="60"/>
                                </StackPanel>
                            </Grid>
                        </Border>
                        <!-- Debug mode -->
                        <CheckBox x:Name="isDebug" Margin="10,10,10,5" Content="Run job in debug mode"></CheckBox>
                        <TextBlock x:Name="ErrorMessageText" Margin="10,0,0,10" Visibility="Hidden" Foreground="Red"></TextBlock>
                    </StackPanel>
                </ScrollViewer>
            </Grid>
        </Border>
    </Grid>
</Window>

